package project3;

public abstract class Cell {
	protected int circId;
	protected Util.CellType cellType;
	
	protected Cell(int circId, Util.CellType cellType) {
		this.circId = circId; 
		this.cellType = cellType;
	}
	
	public static Cell createCell(byte[] data, Util.CellType cellType) {
		int circId = Util.readCircId(data);
		// Util.CellType cellType = Util.readCellType(data);
		
		if (cellType == Util.CellType.RELAY) {
			return new RelayCell(data);			
		} else {
			return ConnectionCell.createConnectionCell(circId, cellType);
		}
	}
	
	public Util.CellType getCellType() { return this.cellType; }
	public int getCircId() { return this.circId; }	
	public void setCircId(int circId) { this.circId = circId; }
	
	public abstract byte[] generateByteData();	
}
